<?php
include_once __DIR__ . '/autoload.php';
include_once dirname(__FILE__) . '/filtro_usuario.php';
include_once dirname(__FILE__) . '/funciones/basicas.php';
use datos\MenuDao;
use utiles\Menu;
//include_once dirname(__FILE__) . '/datos/MenuDao.php';
//include_once dirname(__FILE__) . '/clases/utiles/Menu.class.php';

$conexion = conectarPDO();
$menuDao = new MenuDao($conexion);
$menu = new  Menu();
$menu->setMenuDao($menuDao);
$menu->setPerfil(strtoupper($_SESSION['perfil']));
$menu->setTarget('iframe');
$menu->setUrlBase($_SESSION['BASE']); 

?>
<html>
<head>
<title>::Sistema de Ventas::</title>
<?php include_once dirname(__FILE__) . '/header.php'; ?>
<link rel="stylesheet" href="<?php echo $_SESSION['BASE'] ?>/js/jqwidgets/styles/jqx.base.css" type="text/css" />    
<script type="text/javascript" src="<?php echo $_SESSION['BASE'] ?>/js/jqwidgets/jqxcore.js"></script>
<script type="text/javascript" src="<?php echo $_SESSION['BASE'] ?>/js/jqwidgets/jqxbuttons.js"></script>
<script type="text/javascript" src="<?php echo $_SESSION['BASE'] ?>/js/jqwidgets/jqxscrollbar.js"></script>
<script type="text/javascript" src="<?php echo $_SESSION['BASE'] ?>/js/jqwidgets/jqxpanel.js"></script>
<script type="text/javascript" src="<?php echo $_SESSION['BASE'] ?>/js/jqwidgets/jqxtree.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            // Create jqxTree
            $('#jqxTree').jqxTree({ height: '97%', width: '200px' });
//             $('#jqxTree').bind('select', function (event) {
//                 var htmlElement = event.args.element;
//                 var item = $('#jqxTree').jqxTree('getItem', htmlElement);
//                 alert(item.label);
//             });
        });
    </script>

<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.Estilo2 {
	color: #666666;
	font-size: 10px;
	font-family: Geneva, Arial, Helvetica, sans-serif;
}
-->
</style>
</head>
<body>
    
<!--Tabla principal de contenido-->
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0">
    <tr height="76">
    <td bgcolor="#FFFFFF" scope="row" background="<?php echo $_SESSION['BASE'] . '/img/bar.png' ?>">
    <div align="left">
    <img title="Logotipo" src="<?php echo $_SESSION['BASE'] . '/img/logo.png' ?>" width="208" height="76">
    </div>
    </td>
    </tr><tr>
    <td>
    <!--Tabla de contenido-->
    <table border="0" height="100%" width="100%">
	<tr>
	<td width="12%">
            <br><br>
            <div id='jqxTree'>
            <ul>
                <?php
                echo $menu->getMenu(1);
                ?>        
            </ul>
            </div>
            <br>           
        </td><td>
	    <iframe frameborder="0" name="iframe" src="" marginheight="0" marginwidth="0" scrolling="auto"  height="100%" width="100%"></iframe>
        </td>
	</tr>
    </table>
    <!--Fin tabla de contenido-->
    </td>
    </tr><tr height="50">
    <td background="img/bar_down.png" class="Estilo2" align="center">
	<?php echo $_SESSION['datos_empresa']['razon_social'] . '<br />' . $_SESSION['datos_empresa']['email'] . ' ' . $_SESSION['datos_empresa']['fono']; ?>
    </td>
    </tr>
</table>

<!--Boton para desconectar-->
<div style="position:absolute;top:10px;left:80%;">
 <a href="index.php?logout=logout"><img src="<?php echo $_SESSION['BASE'] . '/img/LogOff.png' ?>" width="45" height="45" border="0"></a>
</div>
<!--Sombra superior-->
<div style="position:absolute;top:76px;left:0px; width:100%; height:7px; background:url(img/sombra.png) repeat-x">
&nbsp;
</div>
<!--Nombre de usuario conectado-->
<div style="position:absolute;top:10px;left:35%;">
 <font color="#666666">Conectado como: <?php echo $_SESSION['nomUsuario']; ?></font>
</div>

</body>
</html>
